get_filename_component(G2O_ROOT "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(G2O_INCLUDE_DIR ${G2O_ROOT}/include ${G2O_ROOT}/include/EXTERNAL/csparse)

file(GLOB_RECURSE LIB_FILES "${G2O_ROOT}/lib/*.lib")

foreach(G2O_LIB_FILE ${LIB_FILES})
    get_filename_component(G2O_LIB "${G2O_LIB_FILE}" NAME)
    list(APPEND G2O_LIBRARIES "${G2O_ROOT}/lib/${G2O_LIB}")
endforeach()

if(MSVC)
  add_definitions(-DWINDOWS) 
endif()

if(DEFINED EIGEN3_INCLUDE_DIR AND EXISTS ${EIGEN3_INCLUDE_DIR})
  message("EIGEN3_INCLUDE_DIR:${EIGEN3_INCLUDE_DIR}")
else()
  message(FATAL_ERROR "EIGEN3_INCLUDE_DIR not defined")
endif()
